import {reqAddressInfo, reqGetorderTrade, } from '@/api/request'
const state = {
    address:[],
    order:{},
}
const mutations = {
    GETADDRESSINFO(state,addressInfo){
        state.address = addressInfo
    },
    GETORDERTRADE(state,data){
        state.order = data
    }
}
const actions = {
    // 获取收获地址信息列表
    async addressInfo({commit}){
        let result = await reqAddressInfo()
        if(result.code===200){
            commit('GETADDRESSINFO',result.data)
        }
    },
    // 获取购物清单信息列表
    async getordertrade({commit}){
        let result = await reqGetorderTrade();
        commit('GETORDERTRADE',result.data)
    }
}
const getters = {
    useraddressInfo(){
        return state.address
    },
    orderTrade(){
        return state.order
    }
}
export default{
    state,
    mutations,
    actions,
    getters,
}